package com.day24.ex03;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

public class ReflectDemo {
    public static void main(String[] args) throws Exception {
        Class<?> c = Class.forName("com.itheima_02.Student");
        Method[] methods = c.getDeclaredMethods();
        for (Method method : methods) {
            System.out.println(method);
        }
        System.out.println("--------");
        Method m = c.getMethod("method1");
        Constructor<?> con = c.getConstructor();
        Object obj = con.newInstance();
        m.invoke(obj);
    }
}

